﻿NExt.DecorateRemoteInstance = function(decorated, assembly, type) {
    decorated.getDefaultConfig = function() {
        if (typeof decorated.DefaultConfig == 'undefined') {
            decorated.DefaultConfig = NExt.remoteSerialize(assembly, type);
        }
        return decorated.DefaultConfig;
    };

    var constructor = function(config) {
        if (typeof config == 'undefined') {
            config = decorated.getDefaultConfig();
        }
        decorated.call(this, config);
    };
    return constructor;
};

NExt.DecorateVariableBind = function(decorated) {
    var constructor = function(config) {
        decorated.call(this, config);
        NExt.bind(config, this);
        if (this.formInitialize) {
            if (!(this.initialized)) {
                this.initialized = true;
                this.formInitialize();
            }
        }
    };
    return constructor;
};